package com.yunxi.controller.otd;

import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.otd.pojo.ProducePlanQueryVO;
import com.yunxi.otd.service.ProducePlanDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 生产计划查询
 * </p>
 *
 * @author XUQI
 * @since 2019-08-17
 */
@RestController
@RequestMapping("/admin/produce/plan")
@Api(tags = "OTD:PLAN", description = "生产计划查询")
public class ProducePlanController {

    private static final Logger logger = LoggerFactory.getLogger(ProducePlanController.class);

    @Autowired
    ProducePlanDubboService producePlanDubboService;

    @GetMapping("/page")
    @ApiOperation(value = "分页查询")
    public ApiResult page(ProducePlanQueryVO queryVO, Integer pageNum, Integer pageSize) {
        return ResponseUtil.ok(producePlanDubboService.pageByVo(queryVO, pageNum, pageSize));
    }

    @GetMapping("/otd")
    @ApiOperation(value = "查看OTD")
    public ApiResult queryOtd(String planNo) {
        return producePlanDubboService.queryOtd(planNo);
    }

    @GetMapping("/otd/info")
    @ApiOperation(value = "查看OTD信息")
    public ApiResult queryOtdInfo(String planNo) {
        return producePlanDubboService.queryOtdInfo(planNo);
    }

    @GetMapping("/export")
    @ApiOperation(value = "导出")
    public ApiResult export(ProducePlanQueryVO queryVO) {
        return ResponseUtil.ok(producePlanDubboService.export(queryVO));
    }
}
